﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;    
using System.Collections;
using log4net;

namespace condortravel.operaciones.common.Log
{
    public class LogApp
    {

        private static ILog logger = LogManager.GetLogger(typeof(LogApp));

	#region "Constructors"
    static LogApp()
	{
		log4net.Config.XmlConfigurator.Configure();
	}
	#endregion
	/// <summary>
	/// Write log based in configuration in configuration's file.
	/// </summary>
	/// <param name="logLevel">Log Level</param>
	/// <param name="log">Message</param>
	/// <remarks></remarks>
	public static void WriteLog(ELogLevel logLevel, string log)
	{
		if (logLevel.Equals(ELogLevel.DEBUG)) {
			logger.Debug(log);
		} else if (logLevel.Equals(ELogLevel.ERROR)) {
			logger.Error(log);
		} else if (logLevel.Equals(ELogLevel.FATAL)) {
			logger.Fatal(log);
		} else if (logLevel.Equals(ELogLevel.INFO)) {
			logger.Info(log);
		} else if (logLevel.Equals(ELogLevel.WARN)) {
			logger.Warn(log);
		}
	}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="logLevel"></param>
        /// <param name="log"></param>
    public static void write(ELogLevel logLevel, string log)
    {
        if (logLevel.Equals(ELogLevel.DEBUG))
        {
            logger.Debug(log);
        }
        else if (logLevel.Equals(ELogLevel.ERROR))
        {
            logger.Error(log);
        }
        else if (logLevel.Equals(ELogLevel.FATAL))
        {
            logger.Fatal(log);
        }
        else if (logLevel.Equals(ELogLevel.INFO))
        {
            logger.Info(log);
        }
        else if (logLevel.Equals(ELogLevel.WARN))
        {
            logger.Warn(log);
        }
    }

}


public enum ELogLevel
{
	DEBUG = 1,
	ERROR = 2,
	FATAL = 3,
	INFO = 4,
	WARN = 5
}
}
